<template>
  <div>
    <!-- 权限列表 -->
    <el-table :data="list" border show-summary style="width: 100%">
      <el-table-column type="index" label="#"> </el-table-column>
      <el-table-column prop="authName" label="名称"> </el-table-column>
      <el-table-column prop="path" label="路径"> </el-table-column>
      <el-table-column prop="level" label="权限">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.level == '0'" @change="list">一级</el-tag>
          <el-tag v-if="scope.row.level == '1'" type="success" @change="list"
            >二级</el-tag
          >
          <el-tag v-if="scope.row.level == '2'" type="warning">三级</el-tag>
          <el-tag v-if="scope.row.level == 'v'" type="warning"
            >石帅军无敌</el-tag
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    this.ranlist();
  },
  methods: {
    ranlist() {
      // 获取列表
      this.$axios
        .get("https://www.liulongbin.top:8888/api/private/v1/rights/list")
        .then((rem) => {
          // 如果成功
          if (rem.meta.status == "200") {
            // 变量赋值
            this.list = rem.data;
            // 打印输出

            // 添加id
            for (var i = 0; i < this.list.length; i++) {
              this.list[i].ids = i + 1;
            }
          }
        });
    },
  },
};
</script>
<style scoped>
</style>